package org.expressme.employee.mgmt.flex;

import java.util.Date;

import org.expressme.employee.mgmt.Employee;
import org.expressme.employee.mgmt.Facade;

public class FlexServiceImpl implements FlexService {

    private static final Employee[] EMPTY_EMPLOYEE_ARRAY = new Employee[0];

    private Facade facade;

    public void setFacade(Facade facade) {
        this.facade = facade;
    }

    public Employee createEmployee(String name, String title, boolean gender, Date birth) {
        return facade.createEmployee(name, title, gender, birth);
    }

    public void deleteEmployee(String id) {
        facade.deleteEmployee(id);
    }

    public Employee[] queryAll() {
        return facade.queryAll().toArray(EMPTY_EMPLOYEE_ARRAY);
    }

    public Employee[] queryByName(String name) {
        return facade.queryByName(name).toArray(EMPTY_EMPLOYEE_ARRAY);
    }

}
